Detect if it is running in a Vmware or being access via RDP to disable graphic accele...
authorCamila Ayres <hello@camilasan.com>
Thu, 19 Dec 2024 14:07:13 +0000 (15:07 +0100)
committerMatthieu Gallien <matthieu.gallien@nextcloud.com>
Wed, 12 Feb 2025 08:54:38 +0000 (09:54 +0100)
There has been reports of the client crashing in a VMware or being accessed via RDP
starting with 3.15.0 due to the client's use of graphic acceleration.

Signed-off-by: Camila Ayres <hello@camilasan.com>
src/gui/application.cpp

index 080ad34e63af0ae70c1f3f11557599478908092e..2ac79a20eaac7bdd3942a2205a81c03ac770d60c 100644 (file)
@@ -232,6 +232,24 @@ Application::Application(int &argc, char **argv)
     // Ensure OpenSSL config file is only loaded from app directory
     QString opensslConf = QCoreApplication::applicationDirPath() + QStringLiteral("/openssl.cnf");
     qputenv("OPENSSL_CONF", opensslConf.toLocal8Bit());
+
+    const auto shouldDisableGraphicsAcceleration = [&]() {
+        const auto systemEnvironment = QProcessEnvironment::systemEnvironment();
+        if (systemEnvironment.contains(QStringLiteral("VMWARE"))) {
+            return true;
+        }
+
+        if (systemEnvironment.contains("SESSIONNAME") && systemEnvironment.value("SESSIONNAME").startsWith("RDP-")) {
+            return true;
+        }
+
+        return false;
+    };
+
+    if (shouldDisableGraphicsAcceleration()) {
+        QProcessEnvironment::systemEnvironment().insert(QStringLiteral("SVGA_ALLOW_LLVMPIPE"), 0);
+        qCInfo(lcApplication) << "Disabling graphics acceleration, application might be running in a virtual or in a remote desktop.";
+    }
 #endif
 
     // TODO: Can't set this without breaking current config paths